﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Netfraction.Network.Protocol.TIGR
{
    [ProtocolFeature(Name = "TIGR")]
    public class ProtocolFeatureTIGR : ProtocolFeature, IProtocolHashFeature
    {
        public struct FeatureActions
        {
            [ProtocolFeatureAction(ActionType = FeatureActionType.MessageExtension)]
            public const string ActionGET = "GET";
        }

        public ProtocolFeatureTIGR()
        {
            this.SupportedActions.AddRange(base.GetFeatureActions(new FeatureActions()));
            
            // Register Handlers
            this.ProtocolMessageHandlers.Add(new ProtocolFeatureAction(FeatureActions.ActionGET, FeatureActionType.MessageExtension), new Extension.ExtensionGETNamedRoot());
            this.ProtocolMessageHandlers.Add(new ProtocolFeatureAction(FeatureActions.ActionGET, FeatureActionType.MessageExtension), new Extension.ExtensionGETType());
        }

        #region IProtocolHashFeature Members

        System.Security.Cryptography.HashAlgorithm IProtocolHashFeature.GetHashAlgorithm()
        {
            return Security.Cryptography.Tiger.Create();
        }

        #endregion
    }
}
